package com.multimedia.scala.euler

import scala.collection.mutable.ListBuffer

object Asd3 {
  def main(args : Array[String]) : Unit = {
      val digit = BigInt(600851)*1000000+475143
      val maxPrime = BigInt(775146)
      val maxDivisor = BigInt(880)

	  def isSimpleBuf(x: BigInt, simples: ListBuffer[BigInt]): Boolean = {
          for (j <- simples) {
              if (x%j==0) return false
          }
          simples += x
    	  true
	  }
      def isSimple(x: BigInt, simples: ListBuffer[BigInt]):Boolean = {
          for (j <- simples) {
              if (x%j==0) return false
          }
          true
      }
	  
	  var simples = ListBuffer[BigInt]()
	  (2 to 880).foreach(isSimpleBuf(_:Int, simples))
	  var primes = (2 to 775146).filter(isSimple(_:Int, simples))
	  println(primes.filter(x=>{digit%x==0}))
  }
}
